<template>
    <div>
        <p>FullName: {{fullName}}</p>
        <p>FirstName: <input type="text" v-model="firstName"></p>
        <div>父组件的值： {{examleid}}
            这是子组件<input v-model="examleid"/>
        </div>
    </div>
</template>
<script>
    export default {
        name: 'WatchTest',
        data() {
            return {fullName: 'fullName', firstName: 'firstName'}
        },
        props: ['examleid'],
        watch: {
            // 当fullName值变化时，watch监听到并且执行
            'firstName'(newName, oldName) {
                this.fullName = newName + ' ' + oldName;
            }
        }
    }
</script>

<style scoped>

</style>
